# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=lcms

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.19
pkgrel=2
pkgdesc="Lightweight color management development library/engine (mingw-w64)"
arch=(any)
url="http://www.littlecms.com"
license=("custom")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-libtiff")
options=('staticlibs' 'strip')
source=("http://downloads.sourceforge.net/sourceforge/lcms/lcms-${pkgver}.tar.gz"
    "cve-2013-4276.patch"
    "lcms-1.17-windows.patch")
md5sums=('8af94611baf20d9646c7c2c285859818'
         'fa1db4861cfa05f4c4a2c826e1c35502'
         '9620be1a5bc2ec407c78f643cab62811')

prepare(){
  cd "$srcdir/${_realname}-$pkgver"
  patch -Np1 -i "$srcdir/cve-2013-4276.patch"
  #patch -Np1 -i "$srcdir/lcms-1.17-windows.patch"
  #autoreconf -f -i
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  ./configure \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX}

  make
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  make DESTDIR="$pkgdir" install
}
